export function useOauth() {
    return new Promise<UniNamespace.LoginRes>((resolve, reject)=>{
        uni.getProvider({
            service: 'oauth',
            success: (res) => {
                // @ts-ignore
                if (res.provider.indexOf('weixin') !== -1) {
                    uni.login({
                        provider: 'weixin',
                        success: (loginRes) => {
                            resolve(loginRes)
                        },
                        fail: (error) => {
                            console.log(error)
                            reject(error)
                        }
                    })
                }
            }
        })
    })
}